package com.msg.test.model;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;

/**
 * Created by Administrator on 2017/10/20 0020.
 */
public class MsgActiveTestResp extends MsgHead{
    private static Log log = LogFactory.getLog(MsgActiveTestResp.class);
    private byte reserved;
    public MsgActiveTestResp(byte[] data){
        if (data.length == 8+1){
            ByteArrayInputStream bins = new ByteArrayInputStream(data);
            DataInputStream dins = new DataInputStream(bins);
            try{
                this.setTotalLength(data.length + 4);
                this.setCommandId(dins.readInt());
                this.setSequence(dins.readInt());
                this.reserved = dins.readByte();
                dins.close();
                bins.close();
            }catch (IOException ex){

            }
        }else{
            log.info("链路检查，解析数据包出错，包长度不一致。长度为："+data.length);
        }
    }

    public byte getReserved() {
        return reserved;
    }

    public void setReserved(byte reserved) {
        this.reserved = reserved;
    }
}
